package com.lzx.answer.controller.web;

import com.lzx.answer.entity.Report;
import com.lzx.answer.service.ReportService;
import com.lzx.common.utils.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author 程序员星星
 * @date 2023/1/5
 * @Description
 */
@RestController
@RequestMapping("/answer/report/web")
public class WebReportController {
    @Resource
    private ReportService reportService;

    //根据用户id查询用户是否举报了当前这个问题
    @GetMapping("/getUserIsReportProblem/{userId}/{problemId}")
    public R getUserIsReportProblem(@PathVariable int userId, @PathVariable int problemId) {
        return reportService.getUserIsReportProblem(userId, problemId);
    }

    //用户举报问题
    @PostMapping("/reportProblem")
    public R reportProblem(@RequestBody Report report) {
        return reportService.reportProblem(report);
    }
}
